<%@ page language="java"
         import="com.ruohi.manage.DBType,com.ruohi.manage.PoolManager,com.ruohi.util.common.CommonForm,com.ruohi.util.common.CommonString,com.ruohi.util.common.Env"
         pageEncoding="UTF-8" %>
<%@ page import="com.ruohi.util.dbutil.DBHelper" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.LinkedHashMap" %>
<%@ page import="java.util.Map" %>
<%
	Connection connection = null;
	String tablePrefix = Env.getInstance().getProperty("table_prefix");
	DBHelper dbHelper = DBHelper.getInstance();
	Map model = new HashMap();
	String tableName = " gift_activity ";
	try{
		connection = PoolManager.getConnection(DBType.getDBTypeByEnum("106013"));
		String id = CommonString.getFormatPara(request.getParameter("id"));
		String channelUUID = CommonString.getFormatPara(request.getParameter("channel_uuid"));
		if(null!=id&&!"".equals(id)){
			model = dbHelper.getMap(" select * from "+tableName+" where uuid = ? ",new Object [] {id} , connection);
		}
		if("".equals(channelUUID)&&null!=model){
			channelUUID = (String)model.get("channel_uuid");
		}
		
		LinkedHashMap is_showMap = new LinkedHashMap();
		is_showMap.put("1", "未结束");
		is_showMap.put("0", "已结束");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><%=Env.getInstance().getProperty("project_name") %></title>
<link href="/plugin/ui/ligerUI/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link href="/plugin/ui/ligerUI/ligerUI/skins/Gray/css/all.css" rel="stylesheet" type="text/css" />
<link href="/plugin/ui/ligerUI/ligerUI/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
<link href="/backend/style/style.css" rel="stylesheet" type="text/css" />
<script src="/plugin/jquery/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8" src="/plugin/editor/ueditor/editor_config.js"></script>
<script type="text/javascript" charset="utf-8" src="/plugin/editor/ueditor/editor_all_min.js"></script>
<link rel="stylesheet" type="text/css" href="/plugin/editor/ueditor/themes/default/ueditor.css"/>
<style type="text/css">
	html { *height:auto; }
</style>
</head>

<body style="margin: 0;padding: 0; overflow-x: hidden; overflow-y: auto; ">
<form name="theform" id="theform" action="/backend/action/crud.jsp?enumNo=106013">
  <div class="formDiv">
  	<div class="group"> <span><img src="/plugin/ui/ligerUI/ligerUI/skins/icons/communication.gif" /></span> <span class="groupTitle">基础信息</span> </div>
    <div class="formLeft">活动名称</div>
    <div class="formRight" style="width: 190px;">
      <input type="text" dataType='Require' msg='活动名称不能为空！' class="jr_text" name="zd_name" id="zd_name" value="<%=CommonString.getFormatPara(model.get("name")) %>" />
    </div>
    <div style="clear:left;"></div>
    <div class="formLeft">活动描述</div>
    <div class="formRight" style="width: 400px;">
      <input type="text" dataType='Require' msg='活动描述不能为空！' class="jr_text" name="zd_description" id="zd_description" value="<%=CommonString.getFormatPara(model.get("description")) %>" />
    </div>
    <div style="clear:left;"></div>
    <div class="formLeft">活动链接地址</div>
    <div class="formRight" style="width: 300px;">
      <input type="text" dataType='Require' msg='活动链接地址不能为空！' class="jr_text" name="zd_link_url" id="zd_link_url" value="<%=CommonString.getFormatPara(model.get("link_url")) %>" />
    </div>
    <div style="clear:left;"></div>
    <div class="formLeft">按钮显示文字</div>
    <div class="formRight" style="width: 190px;">
    	<input type="text" dataType='Require' msg='按钮显示文字不能为空！' class="jr_text" name="zd_button_text" id="zd_button_text" value="<%=CommonString.getFormatPara(model.get("button_text")) %>" />
    </div>
    <div style="clear:left;"></div>
    <div class="formLeft">活动时间</div>
    <div class="formRight" style="width:190px">
      <input type="text" dataType='Require' msg='活动时间不能为空！' class="jr_text" name="zd_activity_time" id="zd_activity_time" value="<%=CommonString.getFormatPara(model.get("activity_time")) %>" />
    </div>
    <div style="clear: left;"></div>
    <div class="formLeft">活动图片</div>
    <div class="formRight" style="width:400px;">
      <input type="text" dataType='Require' msg='活动图片不能为空！' readonly="readonly" style="width: 400px;float:left;" class="jr_text" name="zd_img" id="zd_img" value="<%=CommonString.getFormatPara(model.get("img")) %>" />
    </div>
    <div class="formRight" style="width: 100px;"> <a href="<%=CommonString.getFormatPara(model.get("img")) %>" id="a_img" onclick='return hs.expand(this)'><img src="/backend/images/yulan.gif" /></a> <span id="equi_img"></span> </div>
    <div style="clear:left;"></div>
    <div class="formLeft">是否结束</div>
    <div class="formRight" style="width:190px">
      <%=CommonForm.createRadio(is_showMap, CommonString.getFormatInt(model.get("is_show")).toString(), "zd_is_show") %>
    </div>
  <div style="clear: left;"></div>
  <input type="hidden" name="tableName" id="tableName" value="<%=tableName %>" />
  <input type="hidden" name="zd_id" id="zd_id" value="<%=CommonString.getFormatPara(model.get("id")) %>" />
</form>
</body>
</html>
<script type="text/javascript" src="/plugin/jquery/jquery.form.js"></script>
<script src="/plugin/ui/ligerUI/ligerUI/js/ligerui.min.js" type="text/javascript"></script>
<script src="/plugin/date/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
<script src="/backend/scripts/common.js" prefix="<%=tablePrefix %>" type="text/javascript"></script>
<script src="/plugin/validator/wofoshan/validator.min.js" type="text/javascript"></script>
<script type="text/javascript" src="/plugin/other/highslide/highslide.min.js"></script>
<script type="text/javascript" src="http://img.52sdskj.com/plugin/upload/jr_upload.js"></script>
<script type="text/javascript">
	hs.graphicsDir = '/plugin/other/highslide/graphics/';
	hs.wrapperClassName = 'wide-border';
	
	jQuery("#equi_img").JrUpload({
        remotUrl: "http://img.52sdskj.com/upload.jsp",
		folder : "saygou" ,
		watermark:false,
		callback : "setEquiImg"
	});
	
	function setEquiImg(data){
        var imgUrl = "http://img.52sdskj.com" + data;
		jQuery("#a_img").attr("href",imgUrl);
		jQuery("#zd_img").val(imgUrl);
	}
	
	function doSub(dialog){
		var rs = Validator.Validate(document.getElementById("theform"),1);
		if(rs){
			jQuery("#theform").ajaxSubmit({
				type : "POST",
				async : false ,
				success : function(data) {
					var rs = parseInt(jQuery.trim(data), 10);
					if (rs > 0 ) {
						window.parent.jQuery.ligerDialog.success("保存成功！", "提示", function(){
							dialog.close();
						});
					} 
				}
			});
		}
	}
</script>
<%
	}catch(Exception e){
		e.printStackTrace();
	}finally{
		dbHelper.freeConnection(connection);
	}
%>